# @Time    :2025/3/31 19:41
class Birds:
    def __init__(self, name, color, skill_description):
        self.name = name
        self.color = color
        self.skill_description = skill_description

    def fly(self):
        print(f"{self.name}正在飞行....")

    def call(self):
        print(f"{self.name}发出叫声....")

    def use_skill(self):
        print(f"{self.name}使用了{self.skill_description}技能")


# 定义红鸟子类
class RedBirds(Birds):
    def __init__(self):
        super().__init__("红火", "红色", "撞击前方障碍物，造成了大量伤害")

    def fly(self):
        print("红火以稳定的速度向前飞行...")

    def call(self):
        print("红火发出‘wei ya 。。。’的叫声")


# 定义黄鸟子类
class YellowBirds(Birds):
    def __init__(self):
        super().__init__("小黄", "黄色", "瞬间加速，穿透薄障碍物")

    def fly(self):
        print("小黄快速向前飞行...")

    def call(self):
        print("小黄发出'逑逑..’的叫声")


# 定义蓝鸟子类
class BlueBirds(Birds):
    def __init__(self):
        super().__init__("小蓝", "蓝色", "华丽变身，分裂成三只小鸟，分散攻击")

    def fly(self):
        print("小蓝优雅的向前飞行...")

    def call(self):
        print("小蓝发出'叽叽叽..’的叫声")


# 定义障碍物
class Obstacle:
    def __init__(self, name, strength):
        self.name = name
        self.strength = strength

    # 攻击堡垒
    def be_attacked(self, bird):
        print(f"{bird.name}冲向了{self.name}")
        bird.use_skill()
        #根据不同的鸟对象，赋值给对应的障碍物带来的伤害
        if isinstance(bird, RedBirds):
            damage = 80
        elif isinstance(bird, YellowBirds):
            damage = 50
        elif isinstance(bird, BlueBirds):
            damage = 30 * 3  # 分裂成三只，每只造成30点的伤害
        self.strength -= damage
        if self.strength <= 0:
            print(f"{self.name}被摧毁了")
        else:
            print(f"{self.name}还剩下{self.strength}点强度了")


# 模拟游戏过程
if __name__ == "__main__":
    # 创建不同的颜色的小鸟
    red_bird = RedBirds()
    ye_bird = YellowBirds()
    bl_bird = BlueBirds()
# 创建障碍物

ob1 = Obstacle("木头堡垒", 100)
ob2 = Obstacle("石头堡垒", 200)

# 红鸟的攻击木头堡垒
ob1.be_attacked(red_bird)
# 黄鸟攻击石头堡垒
ob2.be_attacked(ye_bird)
# 蓝鸟攻击石头堡垒
ob2.be_attacked(bl_bird)
